<template>
	<view>
		<view class="title-row">
			<uni-row>
				<uni-col :offset="1" :span="11">课程名</uni-col>
				<uni-col :span="3">学分</uni-col>
				<uni-col :span="3">绩点</uni-col>
				<uni-col :span="6">是否认证</uni-col>
			</uni-row>
		</view>
		<view v-for="(item, index) in courseList" class="row">
			<uni-row>
				<uni-col :offset="1" :span="11">{{item.name}}</uni-col>
				<uni-col :span="3">{{item.credit}}</uni-col>
				<uni-col :span="3">{{item.score}}</uni-col>
				<uni-col :span="6">{{item.isvalid}}</uni-col>
				
			</uni-row>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				year:0,
				courseList:[]
			}
		},
		onLoad(config){
			this.year=config.year;
			const API_BASE_URL = this.$ProjectConfig.API_BASE_URL;
			const this2 = this;
			wx.request({
				url: API_BASE_URL + '/course/courseDetail',
				method: 'GET',
				header: {
				  'Content-Type': 'application/json',
				},
				data: {
				    user_id:uni.getStorageSync("user_id"),
					year:this2.year
				},
				success: function(res) {
					console.log(res);
					this2.courseList=res.data
				}
			});
			
			
			
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
.title-row{
	font-size: $uni-font-size-lg;
	font-weight: 600;
	color: #666;
	text-align: center;
}
.row{
	font-size: $uni-font-size-base;
	text-align: center;
}
.row:nth-of-type(even) {
 background-color: #eee;
}
</style>
